home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / g_man / cat3 / OpenGL-ftn / fgldetailtexfuncsgis.z / fgldetailtexfuncsgis
Text File  |  1998-10-20  |  19KB  |  265 lines

  1.  
  2.  
  3.  
  4. ffffggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS((((3333GGGG))))       OOOOppppeeeennnnGGGGLLLL RRRReeeeffffeeeerrrreeeennnncccceeee       ffffggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS((((3333GGGG))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      ffffggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS - specify detail texture scaling function
  10.  
  11.  
  12. FFFFOOOORRRRTTTTRRRRAAAANNNN SSSSPPPPEEEECCCCIIIIFFFFIIIICCCCAAAATTTTIIIIOOOONNNN
  13.      SUBROUTINE ffffggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS( INTEGER*4 _t_a_r_g_e_t,
  14.                                       INTEGER*4 _n,
  15.                                       CHARACTER*8 _p_o_i_n_t_s )
  16.  
  17.  
  18. PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS
  19.      _t_a_r_g_e_t  The target to which the scaling function will be applied. Must be
  20.              GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD.
  21.  
  22.      _n       The number of scaling function samples in points.
  23.  
  24.      _p_o_i_n_t_s  An array of scaling function samples, each of which is an (_L_O_D,
  25.              _f_u_n_c_t_i_o_n-_v_a_l_u_e) pair.
  26.  
  27. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  28.      The detail texture extension defines three additional texture
  29.      magnification filters.  These filters are selected by choosing one of the
  30.      values GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____SSSSGGGGIIIISSSS, GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____AAAALLLLPPPPHHHHAAAA____SSSSGGGGIIIISSSS, or
  31.      GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____CCCCOOOOLLLLOOOORRRR____SSSSGGGGIIIISSSS for the current 2D texture's
  32.      GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____MMMMAAAAGGGG____FFFFIIIILLLLTTTTEEEERRRR.
  33.  
  34.      All three filters sample the level zero texture array exactly as it would
  35.      be sampled with filter mode GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR.  All three also sample the level
  36.      zero texture array of a second texture, known as the detail texture, when
  37.      two conditions are met.  The detail texture corresponding to texture
  38.      GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD is GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS.  The conditions are:
  39.  
  40.           1.  The active texture must be GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD.
  41.  
  42.           2.  The internal formats of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD and
  43.               GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS must have been specified identically.
  44.  
  45.           3   The level 0 image of GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS must have nonzero
  46.               width and height.
  47.  
  48.           4   If the internal formats of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD and
  49.               GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS are one of the dual or quad texture
  50.               storage formats as defined by SSSSGGGGIIIISSSS____tttteeeexxxxttttuuuurrrreeee____sssseeeelllleeeecccctttt, then the
  51.               corresponding texture group selection must be specified
  52.               identically.
  53.  
  54.      If these conditions are not met, it is as though the magnification
  55.      texture filter was GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR.  (Although querying the magnification
  56.      filter value will return the value as specified.)  If they are met, the
  57.      level zero array of the detail texture is also linearly sampled, using
  58.      the following arithmetic:
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ffffggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS((((3333GGGG))))       OOOOppppeeeennnnGGGGLLLL RRRReeeeffffeeeerrrreeeennnncccceeee       ffffggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS((((3333GGGG))))
  71.  
  72.  
  73.  
  74.           n = log base 2 of the width of the level zero array of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD
  75.           m = log base 2 of the height of the level zero array of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD
  76.           N = log base 2 of the width of GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS
  77.           M = log base 2 of the height of GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS
  78.           L = GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____LLLLEEEEVVVVEEEELLLL____SSSSGGGGIIIISSSS value of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD
  79.  
  80.           u = s * 2**(n-L)
  81.           v = t * 2**(m-L)
  82.  
  83.           i0 = floor(u - 1/2) mod 2**N
  84.           j0 = floor(v - 1/2) mod 2**M
  85.  
  86.           i1 = (i0 + 1) mod 2**N
  87.           j1 = (j0 + 1) mod 2**M
  88.  
  89.           A = frac(u - 1/2)
  90.           B = frac(v - 1/2)
  91.  
  92.           Tdetail = (1-A) * (1-B) * detail[i0,j0] +
  93.                        A  * (1-B) * detail[i1,j0] +
  94.                     (1-A) *    B  * detail[i0,j1] +
  95.                        A  *    B  * detail[i1,j1]
  96.  
  97.  
  98.      Note that magnification corresponds to negative values of level-of-detail
  99.      and minification corresponds to positive values.  Hence _L, the value of
  100.      the GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____LLLLEEEEVVVVEEEELLLL____SSSSGGGGIIIISSSS parameter of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD, must be
  101.      negative. The absolute value of _L can be thought of as the number of
  102.      levels that separate the layer zero image of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD and the image
  103.      of GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS, which is replicated as necessary to fill
  104.      the appropriate number of texels.  For example, if _L is -2, the detail
  105.      texture image is replicated as necessary in x and y to form a single
  106.      image whose dimensions are four times larger than the level zero array of
  107.      GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD.
  108.  
  109.      The texture value computed from the primary texture (_T_t_e_x_t_u_r_e) and the
  110.      value computed from the detail texture (_T_d_e_t_a_i_l) are combined in one of
  111.      two ways to compute the final texture value (_T).  The values of _T_t_e_x_t_u_r_e,
  112.      _T_d_e_t_a_i_l, and _T are treated as though they range from 0.0 through 1.0 in
  113.      these equations.
  114.  
  115.      If GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____MMMMOOOODDDDEEEE____SSSSGGGGIIIISSSS of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD is GGGGLLLL____AAAADDDDDDDD, then
  116.  
  117.           T' = Ttexture + F(LOD) * (2*Tdetail-1)
  118.  
  119.           T = 0  if T' < 0;
  120.               T' if 0 <= T' <= 1;
  121.               1  if T' > 1.
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. ffffggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS((((3333GGGG))))       OOOOppppeeeennnnGGGGLLLL RRRReeeeffffeeeerrrreeeennnncccceeee       ffffggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS((((3333GGGG))))
  137.  
  138.  
  139.  
  140.      where _F is a function of the level-of-detail parameter _L_O_D.  In effect,
  141.      the detail texture is scaled and biased so that its range is [-1,1].  The
  142.      resulting signed value is scaled by a function of _L_O_D, added to the base
  143.      texture, and clamped to [0,1].
  144.  
  145.      If GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____MMMMOOOODDDDEEEE____SSSSGGGGIIIISSSS of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD is GGGGLLLL____MMMMOOOODDDDUUUULLLLAAAATTTTEEEE, then
  146.  
  147.           T' = Ttexture * (1 + F(LOD) * (2*Tdetail-1))
  148.  
  149.           T = 0  if T' < 0;
  150.               T' if 0 <= T' <= 1;
  151.               1  if T' > 1.
  152.  
  153.  
  154.      Here again the detail texture is scaled and biased so that its range is
  155.      [-1,1].  The resulting signed value is scaled by a function of _L_O_D and
  156.      biased by 1.  This result scales the base texture, which is then clamped
  157.      to [0,1].
  158.  
  159.      ffffggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS is used to specify the scaling function _F.  _t_a_r_g_e_t
  160.      must be GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD.  _n specifies the number of pairs of values in
  161.      _p_o_i_n_t_s.  _p_o_i_n_t_s points to an array of pairs of floating point values.
  162.      The first value of each pair specifies a value of _L_O_D, and the second
  163.      value of each pair specifies the corresponding function value.  The order
  164.      in which the points are specified is not significant.  The _n value pairs
  165.      in _p_o_i_n_t_s completely specify the function, replacing any previous
  166.      specification that may have existed.
  167.  
  168.      The function _F is evaluated by fitting a curve through the sample points
  169.      specified in _p_o_i_n_t_s.  This curve may be linear between adjacent points,
  170.      or it may be smoothed, but it will pass exactly through the points,
  171.      limited only by the resolution of the implementation.  The value pair
  172.      with the lowest _L_O_D value specifies the function value _F for all values
  173.      of _L_O_D less than or equal to that pair's _L_O_D.  Likewise, the value pair
  174.      with the greatest _L_O_D value specifies the function value _F for all values
  175.      of _L_O_D greater than or equal to that pair's _L_O_D.
  176.  
  177.      Since negative values of _L_O_D correspond to magnification and positive
  178.      values correspond to minification, the points should have negative _L_O_D
  179.      values (although specifying a positive value does not generate an error).
  180.      For example, an _L_O_D of -4 corresponds to a magnification by a factor of
  181.      2**4, or 16.  The default function points are (0,0) and (-4,1).
  182.  
  183.      If the texture magnification filter is GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____SSSSGGGGIIIISSSS, then both
  184.      the color and the alpha components of _T are computed as described in the
  185.      equations above.  If the filter is GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____CCCCOOOOLLLLOOOORRRR____SSSSGGGGIIIISSSS, then all
  186.      components of _T other than alpha are computed as described above, and the
  187.      alpha component of _T is computed as if the texture magnification filter
  188.      were GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR.  Finally, if the filter is GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____AAAALLLLPPPPHHHHAAAA____SSSSGGGGIIIISSSS,
  189.      the alpha component of _T is computed as described in the equations above,
  190.      and all other components of _T are computed as if the texture
  191.      magnification filter were GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR.
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. ffffggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS((((3333GGGG))))       OOOOppppeeeennnnGGGGLLLL RRRReeeeffffeeeerrrreeeennnncccceeee       ffffggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS((((3333GGGG))))
  203.  
  204.  
  205.  
  206. NNNNOOOOTTTTEEEESSSS
  207.      The detail texture itself is specified by calling ffffggggllllTTTTeeeexxxxIIIImmmmaaaaggggeeee2222DDDD with
  208.      target set to GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS, level set to 0, border set to 0,
  209.      and the other parameters specified to generate the desired image.
  210.  
  211.      As a general rule, avoid using detail texturing if the base texture is
  212.      not significantly larger than the detail texture; filtering artifacts can
  213.      occur under conditions of high magnification.  (For example, it's not a
  214.      good idea to use a 256x256 detail texture with a 128x128 base texture.)
  215.      Instead, make the base texture larger and incorporate more high-frequency
  216.      information in the larger mipmap levels.  This is more efficient than
  217.      using detail texturing and eliminates some rendering artifacts.
  218.  
  219. EEEERRRRRRRROOOORRRRSSSS
  220.      GGGGLLLL____IIIINNNNVVVVAAAALLLLIIIIDDDD____EEEENNNNUUUUMMMM is generated if _t_a_r_g_e_t is not GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD.
  221.  
  222.      GGGGLLLL____IIIINNNNVVVVAAAALLLLIIIIDDDD____VVVVAAAALLLLUUUUEEEE is generated if _n is negative.
  223.  
  224.      GGGGLLLL____IIIINNNNVVVVAAAALLLLIIIIDDDD____OOOOPPPPEEEERRRRAAAATTTTIIIIOOOONNNN is generated if ffffggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS is executed
  225.      between the execution of ffffggggllllBBBBeeeeggggiiiinnnn and the corresponding execution of
  226.      ffffggggllllEEEEnnnndddd.
  227.  
  228. AAAASSSSSSSSOOOOCCCCIIIIAAAATTTTEEEEDDDD GGGGEEEETTTTSSSS
  229.      ffffggggllllGGGGeeeettttTTTTeeeexxxxPPPPaaaarrrraaaammmmeeeetttteeeerrrr, ffffggggllllGGGGeeeettttDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS.
  230.  
  231.  
  232. MMMMAAAACCCCHHHHIIIINNNNEEEE DDDDEEEEPPPPEEEENNNNDDDDEEEENNNNCCCCIIIIEEEESSSS
  233.      On RealityEngine, RealityEngine2, and VTX systems detail texturing may
  234.      not be used when rendering to pixmaps.
  235.  
  236.      Detail texturing acts as if the mipmap stack were extended by a number of
  237.      levels equal to the absolute value of the GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____LLLLEEEEVVVVEEEELLLL____SSSSGGGGIIIISSSS
  238.      parameter.  The number of normal mipmap levels plus the number of detail
  239.      levels must not exceed the maximum number of levels that can be supported
  240.      on the hardware.  For example, on InfiniteReality systems the maximum
  241.      number of levels is 15.  A detail texture at level -4 could be supported
  242.      on a base texture of size 2K (that is, a base texture with 11 levels) but
  243.      not on a base texture that is larger than 2K (one with 12 or more
  244.      levels).  Failure to observe this constraint causes detail textures to
  245.      swim or jitter.
  246.  
  247.  
  248. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  249.      ffffggggllllTTTTeeeexxxxIIIImmmmaaaaggggeeee2222DDDD, ffffggggllllTTTTeeeexxxxPPPPaaaarrrraaaammmmeeeetttteeeerrrr, ffffggggllllTTTTeeeexxxxSSSSuuuubbbbIIIImmmmaaaaggggeeee2222DDDDEEEEXXXXTTTT.
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.